import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_ahj_app/base/cunchu/UserInfoUtils.dart';
import 'package:flutter_ahj_app/base/utils/JUIKit/JFlatButton.dart';
import 'package:flutter_ahj_app/base/utils/ToastUtils.dart';
import 'package:flutter_ahj_app/base/utils/mTopBar.dart';


///反馈
class FeedSubPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => FeedSubPageState();
}

class FeedSubPageState extends State<FeedSubPage> {
  String feedStr = "";

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Material(
        child: new Scaffold(
          appBar: MTopBar(
              title: "反馈",
              leftButtonIcon: Icons.close,
              rightButtonIcon: Icons.send,
              onRightButtonIconClick: () => _rightClick()).create(),
          body: _bodyView(),
        ),
      ),
    );
  }

  _bodyView() {
    return Card(
      elevation: 0,
      margin: EdgeInsets.all(0),
      color: Colors.white,
      child: Column(
        children: <Widget>[
          ListTile(
            title: Text("发件人：${UserInfoUtils.getUserNiceName()}"),///UserInfoUtils.getUserNiceName()
          ),
          ListTile(
            title: TextField(
              autofocus: true,
              maxLines: 5,
              minLines: 1,
              controller: new TextEditingController(text: feedStr),
              keyboardType: TextInputType.multiline,
              decoration: InputDecoration(
                labelText: "写下您的反馈和建议",
              ),
              onChanged: (String str) {
                feedStr = str;
              },
            ),
          ),

        ],
      ),
    );
  }

  _rightClick() {
    var data = {
      'content': feedStr,
    };


//    // 意见反馈
//    static String feedback = "${riskServerUrl}cooperation/v1/system/feedback";
//
//    HttpUtils.httpPostJson(HttpConst.feedback, data, (result) {
//
//      ToastUtils.showToast("提交成功");
//      Navigator.pop(context);
//    }, failed: (str) {
//      ToastUtils.showToast("提交成功");
//      Navigator.pop(context);
//    }, context: context);
  }
}
